using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Collections.Generic;
public partial class pages_Default : PagedPage
{
    public override string RequestString
    {
        get { return""; }
    }
    protected void Page_Load(object sender, EventArgs e)
    {       
        p = Request["page"];
        totals = 0;
        currentPage = GetPageNumber(p);
        if (!IsPostBack) LoadData();
    }
    public void LoadData()
    {
        TourDAO daoTour = new TourDAO();
        LocationDAO daoLoc = new LocationDAO();
        PlaceDAO daoPlace = new PlaceDAO();
        pageSize = 6;
        IList<Tour> newTours = daoTour.GetRecommendedTours(currentPage,pageSize,ref totals,true,ServiceObject.Published);
       //new tour
        rptNew.DataSource = newTours;      
        rptNew.DataBind();       
        //tour for top slide show
        IList<Tour> rndTour = daoTour.GetToursInRandom(12);
        rptSlideShow.DataSource = rndTour;
        //place
        pageSize = 6;
        rptPlace.DataSource = daoPlace.GetRecommendedPlaces(currentPage, pageSize, ref totals, true, ServiceObject.Published);
        rptPlace.DataBind();
        rptSlideShow.DataBind();      
    }
    /// <summary>
    /// This method is used to set visible value for 'Discount' field
    /// </summary>
    /// <param name="value">discount amount</param>
    /// <returns>Return true if discount greater than 0, else return false. </returns>
    public bool GetDiscountState(object value)
    {
        decimal d = decimal.Parse(value.ToString());
        if (d > 0) return true;
        return false;
    }
}
